/*
 * ModificarPaginaAction.java
 *
 * Created on 12 de noviembre de 2007, 0:13
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package webportlet.model.portletfacade.plain.action;

import java.sql.Connection;
import webportlet.model.indiceBursatil.dto.IndiceBursatilDTO;
import webportlet.model.indiceBursatil.dao.SQLIndiceBursatilDAO;
import webportlet.model.indiceBursatil.dao.SQLIndiceBursatilDAOFactory;
import webportlet.model.indiceBursatil.dto.IndiceBursatilDTO;
import webportlet.model.pagina.dao.SQLPaginaDAO;
import webportlet.model.pagina.dao.SQLPaginaDAOFactory;
import webportlet.model.pagina.dto.PaginaDTO;
import webportlet.model.util.DuplicateInstanceException;
import webportlet.model.util.InstanceNotFoundException;
import webportlet.model.util.InternalErrorException;
import webportlet.model.util.TransactionalPlainAction;

public class ModificarPaginaAction implements TransactionalPlainAction{
    
    private PaginaDTO paginaDTO;
    
       
    public ModificarPaginaAction(PaginaDTO paginaDTO) {
        
        this.paginaDTO = paginaDTO;
        
    }
     public Object execute(Connection connection) 
        throws InstanceNotFoundException, DuplicateInstanceException, 
               InternalErrorException {
                
        SQLPaginaDAO paginaDAO = SQLPaginaDAOFactory.getDAO();
        
        paginaDAO.update(connection, paginaDTO);
        
        return paginaDAO.find(connection,paginaDTO.getNickName());            
    }    
    
}
